Remove unused stmcache.UnlimitedCache#2427
Conversation
|
To be honest I'd be more inclined to remove the unused I also don't think encouraging an unlimited cache size is a good idea. I think an unlimited or extremely large cache size is more likely to cause problems such as OOM on the PostgreSQL server. While I was unable to find any definite benchmarks or rules, my understanding is that more than 1,000 prepared statements is asking for trouble. For reference, pgx's default max cache size is 512. If you really want an unlimited cache size you can do that now by setting the cache size to |
|
Hi, thanks for the quick response! My use case was quite simple: I have an app with a limited number of queries (all generated by sqlc, no dynamic ones) and therefore I don't need to limit the cache size and I wanted to opt-in for a simpler cache implementation. My goal wasn't to really allow thousands of queries, but to simply don't bother with limiting them since it is a wasted time in my case. I think the lib users should have power to control stuff like that. But your points are of course valid and if you chose to remove it instead, I'll live. What if we add warning to the Let me know -> I'll either add the comment, or change the PR to remove it. |
I'm still against it. As mentioned above it would almost always be a mistake to set cache size above 1000. And if you really do need unlimited, you can set it to
Let's change it to remove |
47c7b91 to
ddc87c8
Compare
|
✔️ |
There is a
stmcache.CacheimplementationUnlimitedCachethat was never used. This PR changes that so that theUnlimitedCacheis used when capacity in config is negative, and if the newly added config option is also set (for BC).